package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojos.User;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
public class HelloListener {

    @KafkaListener(topics = "hello-topic")
    public void getMsg(String message){
            System.out.println(message);
    }

    @KafkaListener(topics = "user-topic")
    public void getMsg1(String msg){
        User user = JSON.parseObject(msg, User.class);
        System.out.println(user);
    }

}